<?php

declare (strict_types = 1);

namespace app;

class BaseService
{
    /**
     * instance
     * @var    array
     */
    private static $instance;
    
    /**
     * @get instance
     * @return   static
     */
    public static function instance()
    {
        $class_name = get_called_class();
        if (empty(self::$instance[$class_name])) {
            self::$instance[$class_name] = new static();
        }
        return self::$instance[$class_name];
    }
}
